package org.jiuling.gaode.geocode.dto;

import org.jiuling.basics.validation.Assertions;
import org.jiuling.gaode.geocode.enums.ExtensionsEnum;
import org.jiuling.gaode.enums.ResponseFormatEnum;

/**
 * 逆地理编码参数数据传输对象
 * @author 紫灵
 * @date 2024年09月26日 13时53分32秒
 */
public class ReGeoCodeParamDto {

    /** 经纬度坐标 */
    private String location;
    /** 返回附近 POI 类型 */
    private String poitype;
    /** 搜索半径 */
    private Integer radius;
    /** 返回结果控制 */
    private ExtensionsEnum extensions;
    /** 道路等级 */
    private Integer roadlevel;
    /** 数字签名 */
    private String sig;
    /** 响应格式 */
    private ResponseFormatEnum output;
    /** 回调函数 */
    private String callback;
    /** 是否优化 POI 返回顺序 */
    private Integer homeorcorp;

    public String getLocation() {
        return location;
    }

    public String getPoitype() {
        return poitype;
    }

    public Integer getRadius() {
        return radius;
    }

    public ExtensionsEnum getExtensions() {
        return extensions;
    }

    public Integer getRoadlevel() {
        return roadlevel;
    }

    public String getSig() {
        return sig;
    }

    public ResponseFormatEnum getOutput() {
        return output;
    }

    public String getCallback() {
        return callback;
    }

    public Integer getHomeorcorp() {
        return homeorcorp;
    }
    

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        public final ReGeoCodeParamDto reGeoCodeParamDto;

        public Builder() {
            this.reGeoCodeParamDto = new ReGeoCodeParamDto();
        }

        public Builder addLocation(String location) {
            this.reGeoCodeParamDto.location = location;
            return this;
        }

        public Builder addPoitype(String poitype) {
            this.reGeoCodeParamDto.poitype = poitype;
            return this;
        }

        public Builder addRadius(Integer radius) {
            this.reGeoCodeParamDto.radius = radius;
            return this;
        }

        public Builder addExtensions(ExtensionsEnum extensions) {
            this.reGeoCodeParamDto.extensions = extensions;
            return this;
        }

        public Builder addRoadlevel(Integer roadlevel) {
            this.reGeoCodeParamDto.roadlevel = roadlevel;
            return this;
        }

        public Builder addSig(String sig) {
            this.reGeoCodeParamDto.sig = sig;
            return this;
        }

        public Builder addOutput(ResponseFormatEnum output) {
            this.reGeoCodeParamDto.output = output;
            return this;
        }

        public Builder addCallback(String callback) {
            this.reGeoCodeParamDto.callback = callback;
            return this;
        }

        public Builder addHomeorcorp(Integer homeorcorp) {
            this.reGeoCodeParamDto.homeorcorp = homeorcorp;
            return this;
        }

        public ReGeoCodeParamDto build() {
            Assertions.StringAssertions.isNotBlank("经纬度坐标不能为空！", this.reGeoCodeParamDto.location);
            return this.reGeoCodeParamDto;
        }

    }
}
